//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by Fernflower decompiler)
//

package com.aidong.dao.wills;

import com.aidong.dao.base.OrderSet;
import com.aidong.dao.wills.BaseDao;
import com.aidong.model.wills.GcTimeTable;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import org.springframework.stereotype.Repository;

@Repository
public class GcTimeTableDao extends BaseDao<GcTimeTable, Integer> {
	public GcTimeTableDao() {
	}

	public List<GcTimeTable> getListByShopDay(String shopCode, Date date1, Date date2) {
		String sqlww = "shopCode=:p1 and classTime>=:p2 and classTime<:p3 and status>0";
		return this.queryList(sqlww, new Object[]{shopCode, date1, date2}, (new OrderSet()).asc("classTime"), -1);
	}

	public int addTimeTable(List<GcTimeTable> list) {
		Iterator i$ = list.iterator();

		while(i$.hasNext()) {
			GcTimeTable table = (GcTimeTable)i$.next();
			this.add(table);
		}

		return list.size();
	}

	public boolean updateStatus(int id, int status) {
		String hql = "update GcTimeTable set status=:p1 where id=:p2";
		return this.updateByHql(hql, new Object[]{Integer.valueOf(status), Integer.valueOf(id)}) > 0;
	}

	public void updateTimeTable(GcTimeTable table) {
		this.update(table);
		String sql = "update GcBespeak set ptCode=:p1, coachCode=:p2, classTime=:p3 where classType=\'2\' and classId=:p4";
		this.updateBySql(sql, new Object[]{table.getPtCode(), table.getCoachCode(), table.getClassTime(), table.getClassId()});
	}
}
